package com.whu.bookstore.entity;

import java.sql.Timestamp;

/**
 * Created by chenshaojie on 2018/5/18,14:03.
 */
public class Order {
    private int id;
    private String userId;
    private Timestamp time;
    private double amount;
    private byte isPaid;

    public int getId () {
        return id;
    }

    public void setId (int id) {
        this.id = id;
    }

    public String getUserId () {
        return userId;
    }

    public void setUserId (String userId) {
        this.userId = userId;
    }

    public Timestamp getTime () {
        return time;
    }

    public void setTime (Timestamp time) {
        this.time = time;
    }

    public double getAmount () {
        return amount;
    }

    public void setAmount (double amount) {
        this.amount = amount;
    }

    public byte getIsPaid () {
        return isPaid;
    }

    public void setIsPaid (byte isPaid) {
        this.isPaid = isPaid;
    }

    @Override
    public boolean equals (Object o) {
        if (this == o) return true;
        if (o == null || getClass() != o.getClass()) return false;

        Order order = (Order) o;

        if (id != order.id) return false;
        if (Double.compare(order.amount, amount) != 0) return false;
        if (isPaid != order.isPaid) return false;
        if (userId != null ? !userId.equals(order.userId) : order.userId != null) return false;
        if (time != null ? !time.equals(order.time) : order.time != null) return false;

        return true;
    }

    @Override
    public int hashCode () {
        int result;
        long temp;
        result = id;
        result = 31 * result + (userId != null ? userId.hashCode() : 0);
        result = 31 * result + (time != null ? time.hashCode() : 0);
        temp = Double.doubleToLongBits(amount);
        result = 31 * result + (int) (temp ^ (temp >>> 32));
        result = 31 * result + (int) isPaid;
        return result;
    }
}
